#ifndef _TLIB_SESSION_H_
#define _TLIB_SESSION_H_

#include <time.h>

//#define TLIB_SESSION_DB_HOST				"localhost"
//#define TLIB_SESSION_DB_USER				"root"
//#define TLIB_SESSION_DB_PASS				""
//#define TLIB_SESSION_DB					"session"
#define TLIB_SESSION_KEY_LEN				10
#define TLIB_SESSION_VAL_LEN				255
#define TLIB_SESSION_TIMEOUT_DEFAULT	1200

#define TLIB_SESSION_ID	"skey"

typedef struct tagTLIB_OIWEB_SESSION 			//Deprecated,keep it just for compatible.
{
  int iUserId;
	char sLoginName[11];
	char sNick[13];
	char sFace[4];
	int iPage;
	int iClub;
	char iUserStatus;
	char iProvinceid;
} TLIB_OIWEB_SESSION;

typedef struct tagTLIB_OIWEB_SESSION2
{
  	int iUserId;
	char sLoginName[11];
	char sNick[13];
	char sFace[4];
	int iPage;
	int iClubStatus;
} TLIB_OIWEB_SESSION2;

extern int (*TLib_Session_OnDelValue)(time_t tmLogout, int iUserId);

int TLib_Session_SetDomainName(char* domain);	//add by cyril 9.30
int TLib_Session_GetUserID(); //add by pilot 2000-6-21
int TLib_Session_Header(int timeout);
int TLib_Session_SetVal(char* name, char* value);
int TLib_Session_GetVal(char* name, char* value);
int TLib_Session_Clear();
int TLib_Session_End();
int TLib_Session_Init(int timeout);
char *TLib_Session_GetSessionID();
int TLib_Session_Set_OIWeb_Value(TLIB_OIWEB_SESSION* pstSession);
int TLib_Session_Get_OIWeb_Value(TLIB_OIWEB_SESSION* pstSession); 			//Deprecated,keep it just for compatible.
int TLib_Session_Get_OIWeb_Value2(TLIB_OIWEB_SESSION2* pstSession);
int TLib_Session_GetTime(time_t* pTime, char* sTime);
int TLib_Session_GetOnlineNumber();
int TLib_Session_InitDB(char *sHost,char *sUser,char *sPass,char *sDbName);
#ifdef GETPASS_SESSION  /*add by jingle 2000-09-18 */
int TLib_Session_Set_Session(char *sKey);
int TLib_Session_Set_SessionInit(int iNum);
int TLib_Session_GetSessionFromUin(char *sUin,char  *sKey);
#endif

#endif
